package com.yomahub.liteflow.example.controller;

import com.yomahub.liteflow.core.FlowExecutor;
import com.yomahub.liteflow.example.bean.my.ResultVo;
import com.yomahub.liteflow.flow.LiteflowResponse;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("flow")
public class MyFlowController {
    @Resource
    private FlowExecutor flowExecutor;
    
    @GetMapping("caculate")
    public String caculate(Integer num){
        LiteflowResponse r = flowExecutor.execute2Resp("caculate", num, ResultVo.class);
        return r.getContextBean(ResultVo.class).getMsg();
    }
}
